<template>
	<div class="app-container">
		<div class="table-wrapper">
			<h4>地下管网易损性计算-连续焊接管道分析方法</h4>
			<el-form :inline="true" ref="queryRef" :rules="rules" label-position="right" :model="params"
				label-width="200px">
				<el-row justify="center">
					<el-col :span="11">
						<el-form-item label="编号：" class="form-item" prop="code">
							<el-input v-model="params.code" placeholder="" :disabled="true" clearable />
						</el-form-item>
					</el-col>
					<el-col :span="11">
						<el-form-item label="年代：" class="form-item" prop="year">
							<el-input v-model="params.year" placeholder="请输入" :disabled="disabled" clearable />
							<!-- <el-select v-model="params.year" placeholder="请选择" class="form-select" :disabled="disabled" clearable>
								<el-option v-for="item in optionList1" :label="item.dictItemName" :value="item.dictItemCode">
								</el-option>
							</el-select> -->
						</el-form-item>
					</el-col>
				</el-row>
				<!-- <el-row justify="center">
					<el-col :span="11">
						<el-form-item label="维护人所属单位：" class="form-item" prop="orgName">
							<el-input v-model="params.orgName" placeholder="" clearable />
						</el-form-item>
					</el-col>
					<el-col :span="11">
						<el-form-item label="维护时间:" class="form-item" prop="createTime">
							<el-date-picker v-model="params.createTime" type="date" placeholder="选择日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
				</el-row> -->
				<el-row justify="center">
					<el-col :span="11">
						<el-form-item label="管道材料：" class="form-item" prop="material">
							<el-select v-model="params.material" placeholder="请选择" class="form-select"
								:disabled="route.query.operateType" clearable>
								<el-option v-for="item in optionList3" :label="item.dictItemName"
									:value="item.dictItemCode">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="11">
						<el-form-item label="设防情况：" class="form-item" prop="intensity">
							<el-select v-model="params.intensity" placeholder="请选择" class="form-select" :disabled="disabled"
								clearable>
								<el-option v-for="item in optionList2" :label="item.dictItemName"
									:value="item.dictItemCode">
								</el-option>
							</el-select>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row v-if="isAdd" justify="end">
					<el-form-item class="bottom-button">
						<!-- <el-button type="primary" @click="handleCalcAdd">新增</el-button> -->
						<!-- <el-button type="primary" @click="handleBrickModify">修改</el-button> -->
						<!-- <el-button type="primary" @click.prevent="handleCalcdelete">删除</el-button> -->
						<!-- <el-button type="primary" @click="showUploadDialog = true">参数导入</el-button> -->
						<el-button type="primary" @click="handleVerify" v-if="!route.query.id">验证</el-button>
						<el-button type="primary" @click="handleBrickApply" v-if="route.query.id">计算</el-button>
						<el-button type="primary" @click="onSubmit" v-if="route.query.id">提交</el-button>
					</el-form-item>
				</el-row>
			</el-form>
			<!-- 数据导入弹框 -->
			<import-data v-if="showUploadDialog" v-model="showUploadDialog" ref="uploadDialog" :uploadUrl="uploadUrl"
				downloadFileName="地下管网-连续焊接管道分析方法计算参数导入.xlsx" @importSuccess="onImport"></import-data>

			<el-form :inline="true" ref="tableRef" :rules="rules" label-position="right" :model="tableFormData">
				<h4>①强地震波造成的管应力</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">Vmax</span>最大地面速度（m/s）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.maxSpeed`" :rules="rules.maxSpeed">
								<el-input v-model="scope.row.maxSpeed" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">amax</span>最大地面速度（m/s）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.maxAccelaration`"
								:rules="rules.maxAccelaration">
								<el-input v-model="scope.row.maxAccelaration" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">D</span>管道直径 (m)
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.diameter`" :rules="rules.diameter">
								<el-input v-model="scope.row.diameter" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">Cp</span>纵波波速（m/s）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.longitudinalWaveVelocity`"
								:rules="rules.longitudinalWaveVelocity">
								<el-input v-model="scope.row.longitudinalWaveVelocity" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="Cs 横波波速（m/s）">
						<template #header>
							<span class="color-red">Cs</span>横波波速（m/s）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.transverseWaveVelocity`"
								:rules="rules.transverseWaveVelocity">
								<el-input v-model="scope.row.transverseWaveVelocity" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="maxPipelineStrain" header-align="center" align="center" width="360">
						<template #header>
							<div>最大管线应变</div>
							<!-- 公式 -->
							<Formula font-size="20px" tagOffset="-6px" :option="[
								{ content: 'ε', sub: 'max' },
								{ content: '=', margin: '0 8px' },
								{ content: '±' },
								{ content: 'V', sub: 'max' },
								{ content: '/' },
								{ content: 'C', sub: 'p' },
								{ content: '±' },
								{ content: 'a', sub: 'max' },
								{ content: '·' },
								{ content: 'D' },
								{ content: '/' },
								{ content: '(2' },
								{ content: 'C', super: '2', sub: 's' },
								{ content: ')' },
							]"></Formula>
						</template>
					</el-table-column>
				</el-table>

				<h4>a）埋地直管段应力计算</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center" width="140">
						<template #header>
							<span class="color-red">E</span>管材弹性模量（N/㎡）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.elasticityModulus`"
								:rules="rules.elasticityModulus">
								<el-input v-model="scope.row.elasticityModulus" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="140">
						<template #header>
							<span class="color-red">F</span>管道横截面积（m2）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.crossSectionalArea`"
								:rules="rules.crossSectionalArea">
								<el-input v-model="scope.row.crossSectionalArea" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">K</span> 地基系数(m)
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.foundationZCoefficient`"
								:rules="rules.foundationZCoefficient">
								<el-input v-model="scope.row.foundationZCoefficient" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="surfaceRatio" header-align="center" align="center">
						<template #header>
							<span class="color-red">L</span> 地震波长（rn）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.earthquakeWavelength`"
								:rules="rules.earthquakeWavelength">
								<el-input v-model="scope.row.earthquakeWavelength" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="120">
						<template #header>
							<span class="color-red">Ф</span>地震波入射角( 。 )
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.earthquakewaveIncidentAngle`"
								:rules="rules.earthquakewaveIncidentAngle">
								<el-input v-model="scope.row.earthquakewaveIncidentAngle" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="poissonsRatio" header-align="center" align="center" label="μ 管材泊桑比">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.poissonsRatio`" :rules="rules.poissonsRatio">
								<el-input v-model="scope.row.poissonsRatio" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="lCos" header-align="center" align="center">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'L', super: '\'' },
								{ content: '=', margin: '0 8px' },
								{ content: 'L/cosΦ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="s" header-align="center" align="center" width="200">
						<template #header>
							<!-- 公式 -->
							<MultilineFormula display="block" fontWeight="bold" :option="[
								{ content: 'ζ' },
								{ content: '=', margin: '0 8px' },
								{
									rows: [
										[{ content: '1' }],
										[
											{ content: '1+' },
											{
												rows: [
													[{ content: 'EF' }],
													[{ content: 'K' }]
												]
											},
											{ content: '(', fontSize: '32px' },
											{
												rows: [
													[{ content: '2π' }],
													[{ content: 'L', super: '\'' }]
												]
											},
											{ content: ')', fontSize: '32px', super: '2' },
										]
									]
								}
							]"></MultilineFormula>
						</template>
					</el-table-column>
					<el-table-column prop="ep" header-align="center" align="center" width="180">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'ε', sub: 'p' },
								{ content: '=', margin: '0 8px' },
								{ content: 'ε', sub: 'max' },
								{ content: '·' },
								{ content: 'ζ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="zdyl" header-align="center" align="center">
						<template #header>
							<div>最大应力</div>
							<!-- 公式 -->
							<Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'σ', sub: 'z' },
								{ content: '=', margin: '0 8px' },
								{ content: 'ε', sub: 'p' },
								{ content: '·' },
								{ content: 'E' },
							]"></Formula>
						</template>
					</el-table-column>
				</el-table>

				<h4>b）弯曲段应力计算</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center" width="100">
						<template #header>
							<span class="color-red">tu</span>土容重计算系数
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.soilbulkDensity1`"
								:rules="rules.soilbulkDensity1">
								<el-input v-model="scope.row.soilbulkDensity1" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="100">
						<template #header>
							<span class="color-red">Lj</span>管埋藏深度计算系数
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.burialDepth`" :rules="rules.burialDepth">
								<el-input v-model="scope.row.burialDepth" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="100">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" :option="[
								{ content: 'β' },
								{ content: '-', left: '-12px', top: '-8px' }
							]"></Formula>
							土静压系数
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.soilstaticPressureCoefficient`"
								:rules="rules.soilstaticPressureCoefficient">
								<el-input v-model="scope.row.soilstaticPressureCoefficient" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="120">
						<template #header>
							<span class="color-red">F</span>管道横截面积（m2）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.crossSectionalArea`"
								:rules="rules.crossSectionalArea">
								<el-input v-model="scope.row.crossSectionalArea" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'ε', scale: 2, sub: 'max' },
							]"></Formula>
						</template>
						<template #default="scope">
							{{ scope.row.maxPipelineStrain }}
							<!-- <el-form-item :prop="`tableData.${scope.$index}.emax`" :rules="rules.emax">
								<el-input v-model="scope.row.emax" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item> -->
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="120">
						<template #header>
							<span class="color-red">E</span>管材弹性模量（N/㎡）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.elasticityModulus`"
								:rules="rules.elasticityModulus">
								<el-input v-model="scope.row.elasticityModulus" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="wqdcsdjl" header-align="center" align="center" width="260">
						<template #header>
							<div>弯曲段产生的剪力</div>
							<!-- 公式 -->
							<Formula font-size="20px" tagOffset="-6px" :option="[
								{ content: 'Q' },
								{ content: '=', margin: '0 8px' },
								{ content: 'ε', scale: 2, sub: 'max' },
								{ content: '·E·F' },
								{ content: '-' },
								{ content: 't', sub: 'u' },
								{ content: '·' },
								{ content: 'L', sub: 'j' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="wj" header-align="center" align="center" width="150">
						<template #header>
							<div>弯矩</div>
							<!-- 公式 -->
							<Formula tagOffset="-6px" :option="[
								{ content: 'M' },
								{ content: '=', margin: '0 8px' },
								{ content: 'Q/' },
								{ content: '(3X' },
								{ content: 'β' },
								{ content: '-', left: '-16px', top: '-15px' },
								{ content: ')', left: '-10px' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="i" header-align="center" align="center">
						<template #header>
							<span class="color-red">i = d1/2</span>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="100">
						<template #header>
							<span class="color-red">d1</span>管道外径（mm）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.pipeOd`" :rules="rules.pipeOd">
								<el-input v-model="scope.row.pipeOd" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="100">
						<template #header>
							<span class="color-red">d2</span>管道内径（mm）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.insideDiameter`" :rules="rules.insideDiameter">
								<el-input v-model="scope.row.insideDiameter" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="ipai" header-align="center" align="center" width="170">
						<template #header>
							<div class="color-red">
								<Formula tagOffset="-6px" :option="[
									{ content: 'I' },
									{ content: '=', margin: '0 8px' },
									{ content: 'π*' },
									{ content: 'd1', super: '4' },
									{ content: '/64' },
									{ content: '-', margin: '0 8px' },
									{ content: 'π*' },
									{ content: 'd2', super: '4' },
									{ content: '/64' },
								]"></Formula>
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="wqylZx" header-align="center" align="center" width="180">
						<template #header>
							<div>弯曲段弯曲应力(轴向)</div>
							<!-- 公式 -->
							<MultilineFormula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'σ', sub: 'w' },
								{ content: '=', margin: '0 8px' },
								{ content: 'i' },
								{ content: '·' },
								{
									rows: [
										[{ content: 'M' }],
										[{ content: 'I' }]
									],
									style: {
										lineHeight: 0.8
									}
								},
							]"></MultilineFormula>
						</template>
					</el-table-column>
					<el-table-column prop="jylHx" header-align="center" align="center" width="180">
						<template #header>
							<div>弯曲段的剪应力（环向）</div>
							<!-- 公式 -->
							<Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'τ', sub: 'w' },
								{ content: '=', margin: '0 8px' },
								{ content: 'Q/F' },
							]"></Formula>
						</template>
					</el-table-column>
				</el-table>

				<h4>c）T型段应力计算</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center" width="120">
						<template #header>
							<span class="color-red">E</span>管材弹性模量（N/㎡）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.elasticityModulus`"
								:rules="rules.elasticityModulus">
								<el-input v-model="scope.row.elasticityModulus" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="F 管道横截面积（m2）" width="120">
						<template #header>
							<span class="color-red">F</span>管道横截面积（m2）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.crossSectionalArea`"
								:rules="rules.crossSectionalArea">
								<el-input v-model="scope.row.crossSectionalArea" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'ε', scale: 2, sub: 'max' },
							]"></Formula>
						</template>
						<template #default="scope">
							{{ scope.row.maxPipelineStrain }}
							<!-- <el-form-item :prop="`tableData.${scope.$index}.emax`" :rules="rules.emax">
								<el-input v-model="scope.row.emax" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item> -->
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="120">
						<template #header>
							<span class="color-red">tu</span>土容重计算系数
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.soilbulkDensity1`"
								:rules="rules.soilbulkDensity1">
								<el-input v-model="scope.row.soilbulkDensity1" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" width="120">
						<template #header>
							<span class="color-red">L'f</span> T型管埋藏深度计算系数
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.tBuriedDepth`" :rules="rules.tBuriedDepth">
								<el-input v-model="scope.row.tBuriedDepth" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="txjtcjyl" header-align="center" align="center" width="220">
						<template #header>
							<div>T型接头处产生的剪力Q＇</div>
							<!-- 公式 -->
							<MultilineFormula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'Q\'' },
								{ content: '=', margin: '0 8px' },
								{
									rows: [
										[
											{ content: 'ε', scale: 2, sub: 'max' },
											{ content: '·E·F' },
											{ content: '-' },
											{ content: 't', sub: 'u' },
											{ content: '·' },
											{ content: 'L\'', sub: 'f' },
										],
										[{ content: '2' }]
									]
								},
							]"></MultilineFormula>
						</template>
					</el-table-column>
					<el-table-column prop="wjT" header-align="center" align="center">
						<template #header>
							<div>弯距M＇</div>
							<!-- 公式 -->
							<Formula fontWeight="bold" :option="[
								{ content: 'M\'' },
								{ content: '=', margin: '0 8px' },
								{ content: 'Q\'' },
								{ content: '/' },
								{ content: '(2' },
								{ content: 'β' },
								{ content: '-', left: '-12px', top: '-15px' },
								{ content: ')', left: '-10px' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="zylZxT" header-align="center" align="center" label="">
						<template #header>
							<div>T型段的正应力(轴向)</div>
							<!-- 公式 -->
							<Formula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'σ', sub: 't' },
								{ content: '=', margin: '0 8px' },
								{ content: 'M\'D' },
								{ content: '/' },
								{ content: '(2·I)' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="jylHxT" header-align="center" align="center">
						<template #header>
							<div>T型段的剪应力（环向）</div>
							<!-- 公式 -->
							<Formula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'τ', scale: '1.5', sub: 't' },
								{ content: '=', margin: '0 8px' },
								{ content: 'Q\'/F' },
							]"></Formula>
						</template>
					</el-table-column>
				</el-table>

				<h4>②温度引起的温度应力σT</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">α</span>管材的线膨胀系数(1／℃）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.linearExpansionCoefficient`"
								:rules="rules.linearExpansionCoefficient">
								<el-input v-model="scope.row.linearExpansionCoefficient" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">K</span>修正系数（自然升温时土对管的约束系数）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.correctionFactor`"
								:rules="rules.correctionFactor">
								<el-input v-model="scope.row.correctionFactor" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="(T。一T1）为温差（℃）">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.temperatureDifference`"
								:rules="rules.temperatureDifference">
								<el-input v-model="scope.row.temperatureDifference" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="wdyl" header-align="center" align="center" label="温度引起的温度应力σT σT=E*α*K*（T。一T1）"
						width="180" />
				</el-table>

				<h4>③管道受有内压时的应力计算</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">D</span>管道直径 (m)
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.diameter`" :rules="rules.diameter">
								<el-input v-model="scope.row.diameter" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">Px</span>管道内压
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.internalPressure`"
								:rules="rules.internalPressure">
								<el-input v-model="scope.row.internalPressure" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="ŋ曲率有关的修正系数">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.curvature`" :rules="rules.curvature">
								<el-input v-model="scope.row.curvature" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<!-- <el-table-column header-align="center" align="center" label="δ  管壁厚度（m）">
							<template #default="scope">
									<el-form-item :prop="`tableData.${scope.$index}.wallThickness`" :rules="rules.wallThickness">
											<span v-if="!scope.row.isEdit">
													{{ scope.row.wallThickness }}
											</span>
											<el-input v-else v-model="scope.row.wallThickness" size="small"></el-input>
											<el-input v-model="scope.row.wallThickness" :disabled="scope.row.disabled"
													size="small" type="number"></el-input>
									</el-form-item>
							</template>
					</el-table-column> -->
					<el-table-column prop="wallThickness" header-align="center" align="center" label="">
						<template #header>
							<span class="color-red">δ</span>管壁厚度（m）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.wallThickness`" :rules="rules.wallThickness">
								<el-input v-model="scope.row.wallThickness" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="hxlyl" header-align="center" align="center">
						<template #header>
							<div>环向拉应力</div>
							<Formula tagOffset="-6px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'ch' },
								{ content: '=', margin: '0 8px' },
								{ content: 'P', sub: 'x' },
								{ content: 'D/2' },
								{ content: 'δ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="zxlyl" header-align="center" align="center">
						<template #header>
							<div>纵向拉应力</div>
							<Formula tagOffset="-6px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'ah' },
								{ content: '=', margin: '0 8px' },
								{ content: '(' },
								{ content: 'D·P', sub: 'x' },
								{ content: '/2δ' },
								{ content: ')' },
								{ content: '·ŋ' },
							]"></Formula>
						</template>
					</el-table-column>
				</el-table>

				<h4>④覆土静压力造成的管段应力的计算</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">D</span>管道直径 (m)
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.diameter`" :rules="rules.diameter">
								<el-input v-model="scope.row.diameter" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">K。</span>土侧向压力系数
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.soilLateralPressure`"
								:rules="rules.soilLateralPressure">
								<el-input v-model="scope.row.soilLateralPressure" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">Y</span>为土容重(N/m3)
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.soilbulkDensity2`"
								:rules="rules.soilbulkDensity2">
								<el-input v-model="scope.row.soilbulkDensity2" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="H 土埋深（m）">
						<template #header>soilBurialDepth
							<span class="color-red">H</span>土埋深（m）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.soilBurialDepth`"
								:rules="rules.soilBurialDepth">
								<el-input v-model="scope.row.soilBurialDepth" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="ps" header-align="center" align="center" label="土静压力 Ps=（1+K。）YH/2"
						width="210" />
					<!-- <el-table-column header-align="center" align="center" label="δ  管壁厚度（m）">
							<template #default="scope">
									<el-form-item :prop="`tableData.${scope.$index}.wallThickness`" :rules="rules.wallThickness">
											<span v-if="!scope.row.isEdit">
													{{ scope.row.wallThickness }}
											</span>
											<el-input v-else v-model="scope.row.wallThickness" size="small"></el-input>
											<el-input v-model="scope.row.wallThickness" :disabled="scope.row.disabled"
													size="small" type="number"></el-input>
									</el-form-item>
							</template>
					</el-table-column> -->
					<el-table-column prop="wallThickness" header-align="center" align="center">
						<template #header>
							<span class="color-red">δ</span>管壁厚度（m）
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.wallThickness`" :rules="rules.wallThickness">
								<el-input v-model="scope.row.wallThickness" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column prop="hxyyl" header-align="center" align="center" label="环向压应力">
						<template #header>
							<div>环向压应力</div>
							<Formula tagOffset="-3px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'cs' },
								{ content: '=', margin: '0 8px' },
								{ content: 'P', sub: 's' },
								{ content: 'D/2δ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="zxyyl" header-align="center" align="center" label="纵向压应力σas＝ μσcs">
						<template #header>
							<div>纵向压应力</div>
							<Formula tagOffset="-3px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'as' },
								{ content: '=', margin: '0 8px' },
								{ content: '', sub: 'μ' },
								{ content: 'σ', scale: 1.2, sub: 'cs' },
							]"></Formula>
						</template>
					</el-table-column>
				</el-table>

				<h4>所有轴向应力之和</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column prop="ep" header-align="center" align="center">
						<template #header>
							<!-- <Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'ε', sub: 'p' },
								{ content: '=', margin: '0 8px' },
								{ content: 'ε', sub: 'max' },
								{ content: '·' },
								{ content: 'ζ' },
							]"></Formula> -->
							<Formula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'σ', sub: 'z' },
								{ content: '=', margin: '0 8px' },
								{ content: 'ε', sub: 'p' },
								{ content: '·' },
								{ content: 'E' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="wqylZx" header-align="center" align="center">
						<template #header>
							<!-- 公式 -->
							<MultilineFormula fontWeight="bold" font-size="20px" tagOffset="-6px" :option="[
								{ content: 'σ', sub: 'w' },
								{ content: '=', margin: '0 8px' },
								{ content: 'i' },
								{ content: '·' },
								{
									rows: [
										[{ content: 'M' }],
										[{ content: 'I' }]
									]
								},
							]"></MultilineFormula>
						</template>
					</el-table-column>
					<el-table-column prop="zylZxT" header-align="center" align="center">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'σ', sub: 't' },
								{ content: '=', margin: '0 8px' },
								{ content: 'M\'D' },
								{ content: '/' },
								{ content: '(2·I)' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="zxlyl" header-align="center" align="center" label="公式">
						<template #header>
							<Formula tagOffset="-6px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'ah' },
								{ content: '=', margin: '0 8px' },
								{ content: '(' },
								{ content: 'D·P', sub: 'x' },
								{ content: '/2δ' },
								{ content: ')' },
								{ content: '·ŋ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="zxyyl" header-align="center" align="center">
						<template #header>
							<Formula tagOffset="-3px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'as' },
								{ content: '=', margin: '0 8px' },
								{ content: '', sub: 'μ' },
								{ content: 'σ', scale: 1.2, sub: 'cs' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="wdyl" header-align="center" align="center" label="σT=E*α*K*（T。一T1）" />
					<el-table-column prop="allSumZx" header-align="center" align="center">
						<template #header>
							<div>所有轴向应力之和</div>
							<div style="font-size: 20px; font-weight: bold;">σ1</div>
						</template>
					</el-table-column>
				</el-table>

				<h4>所有环向应力之和</h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column prop="jylHx" header-align="center" align="center">
						<template #header>
							<Formula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'τ', sub: 'w' },
								{ content: '=', margin: '0 8px' },
								{ content: 'Q/F' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="jylHxT" header-align="center" align="center" label="公式">
						<template #header>
							<!-- 公式 -->
							<Formula fontWeight="bold" tagOffset="-6px" :option="[
								{ content: 'τ', sub: 'w' },
								{ content: '=', margin: '0 8px' },
								{ content: 'Q\'/F' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="hxlyl" header-align="center" align="center">
						<template #header>
							<Formula tagOffset="-3px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'ch' },
								{ content: '=', margin: '0 8px' },
								{ content: 'P', sub: 'x' },
								{ content: 'D/2' },
								{ content: 'δ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="hxyyl" header-align="center" align="center">
						<template #header>
							<Formula tagOffset="-3px" :option="[
								{ content: 'σ', scale: 1.2, sub: 'cs' },
								{ content: '=', margin: '0 8px' },
								{ content: 'P', sub: 's' },
								{ content: 'D/2δ' },
							]"></Formula>
						</template>
					</el-table-column>
					<el-table-column prop="allSumHx" header-align="center" align="center">
						<template #header>
							所有环向应力之和 <span style="font-size: 20px; font-weight: bold;">σ2</span>
						</template>
					</el-table-column>
				</el-table>

				<h4>根据第三强度理论计算组合应力 [σ] </h4>
				<el-table class="listTables" ref="multipleTableRef" border :data="tableFormData.tableData"
					style="width: 100%" @selection-change="handleSelectionChange"
					:cell-style="{ border: '1px solid #e5ebf7' }"
					:header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
					<el-table-column type="index" width="55" label="序号" />
					<el-table-column prop="allSumZx" header-align="center" align="center" label="σ1" />
					<el-table-column prop="allSumHx" header-align="center" align="center" label=" σ2" />
					<el-table-column prop="permissibleTress" header-align="center" align="center">
						<template #header>
							<div>许用应力</div>
							<div>[σ] = |σ1- σ2|</div>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="修正值">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.permissibleTressCorrect`"
								:rules="rules.permissibleTressCorrect">
								<el-input v-model="scope.row.permissibleTressCorrect" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">[σ1]</span>管道材料的屈服极限应力
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.yieldLimitStress`"
								:rules="rules.yieldLimitStress">
								<el-input v-model="scope.row.yieldLimitStress" :disabled="scope.row.disabled" size="small"
									type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center">
						<template #header>
							<span class="color-red">[σ2]</span>管道材料的强度极限应力
						</template>
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.strengthLimitStress`"
								:rules="rules.strengthLimitStress">
								<el-input v-model="scope.row.strengthLimitStress" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label=" α1">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.adjustmentCoefficient1`"
								:rules="rules.adjustmentCoefficient1">
								<el-input v-model="scope.row.adjustmentCoefficient1" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<!-- <el-table-column header-align="center" align="center" label="修正值">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.yieldLimitStressCorrect`"
								:rules="rules.yieldLimitStressCorrect">
								<el-input v-model="scope.row.yieldLimitStressCorrect" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column> -->
					<el-table-column header-align="center" align="center" label=" α2">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.adjustmentCoefficient2`"
								:rules="rules.adjustmentCoefficient2">
								<el-input v-model="scope.row.adjustmentCoefficient2" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
					<!-- <el-table-column header-align="center" align="center" label="修正值">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.strengthLimitStressCorrect`"
								:rules="rules.strengthLimitStressCorrect">
								<el-input v-model="scope.row.strengthLimitStressCorrect" :disabled="scope.row.disabled"
									size="small" type="number"></el-input>
							</el-form-item>
						</template>
					</el-table-column> -->
					<el-table-column prop="lxBreakState" header-align="center" align="center" label="管道破坏状态">
						<template #header>
							<span class="color-red">管道破坏状态</span>
						</template>
					</el-table-column>
					<el-table-column header-align="center" align="center" label="修正值">
						<template #default="scope">
							<el-form-item :prop="`tableData.${scope.$index}.lxBreakStateCorrect`"
								:rules="rules.lxBreakStateCorrect">
								<el-input v-model="scope.row.lxBreakStateCorrect" :disabled="scope.row.disabled"
									size="small"></el-input>
							</el-form-item>
						</template>
					</el-table-column>
				</el-table>
			</el-form>
			<!-- 版本查看 -->
			<GetVersion v-if="openDialog" v-model:open="openDialog" @recalculateVersion="recalculateVersion" />
			<el-dialog v-model="dialogVisible" @close="cancle" title="提示" width="500px">
				<p v-for="item in messageList">{{ item.label }}
					<el-popover placement="bottom" title="提示详情" :width="200" trigger="click">
						<template #reference>
							<span style="color: #107ce5;cursor: pointer;">提示详情</span>
						</template>
						<template #default>
							<p v-for="val in item.value">{{ val }}</p>
						</template>
					</el-popover>
				</p>
				<p>&nbsp;</p>
			</el-dialog>
		</div>
	</div>
</template>

<script setup>
import { reactive, toRefs } from "vue";
import { ElMessageBox } from 'element-plus'
// 接口
import { getInfo } from '@/api/login';
import { getUserId } from "@/utils/auth";
import {
	getByIdAndType, //查询
	countContinuousWelding, //计算
	saveContinuousWelding, //保存
	importContinuousWeldingUrl, // 参数导入
	recalculate, // 获取版本
	somputationSave,//计算保存
} from "@/api/lifelineVulnerAnalysis/lifelineVulnerAnalysis.js";
import { getValidDictItemsByDictCode } from "@/api/map/disasterDataManagement/lifelineSystemInfo.js";
// 公用方法
import { parseTime } from "@/utils/ruoyi.js";
// 引入公式组件
import Formula from '@/components/Formula';
import MultilineFormula from '@/components/Formula/multiline';
import GetVersion from './Version';
// 引入导入弹框
import ImportData from "@/components/ImportData";

// 引入store
import useUserStore from '@/store/modules/user';
import useDictStore from '@/store/modules/dict';
// 获取pinia
const userStore = useUserStore();
// 用户名
const userName = computed(() => userStore.name || '');
// 所属机构名称
const orgName = computed(() => userStore.orgName || '');
// 当前实例
const { proxy } = getCurrentInstance();
// 当前路由
const route = useRoute();
const router = useRouter();

// 打开类型，query为查看
let operateType = computed(() => route.query.operateType || false);
// 是否是新增页，有路由参数是详情页，否则是新增页
let isAdd = computed(() => (route.query.id && route.query.operateType ? false : true));
// 禁用
const disabled = ref(false);

// 最多保留N小数 ,N 在 options {decimals: N} 中定义
const positivedecimals = (rule, value, callback) => {
	value = String(value);
	if (
		value.indexOf(".") != -1 &&
		(value.split(".").length > rule.options.decimals ||
			value.split(".")[0] === "" ||
			value.split(".")[1] === "")
	) {
		callback(new Error()); //防止输入多个小数点
	} else if (
		value.indexOf(".") != -1 &&
		value.split(".")[1].length > rule.options.decimals
	) {
		callback(new Error()); //小数点后两位
	} else {
		callback();
	}
};
//验证是否yyyy年份（非必填）
const isYearNotMust = (rule, value, callback) => {
	if (value == '' || value == undefined || value == null) {
		callback();
	} else if (isNaN(Number(value))) {
		callback(new Error('请输入yyyy格式如2022'));
	} else if (value.toString().length != 4) {
		callback(new Error('请输入yyyy格式如2022'));
	} else if (value.toString().indexOf(".") != -1) {
		callback(new Error('请输入yyyy格式如2022'));
	} else {
		callback();
	}
}
const data = reactive({
	// 表单参数
	params: {
		code: "",//编号
		material: "",//管道材料
		year: "",//年代
		intensity: "", //设防情况
		createTime: parseTime(new Date()), //维护时间
		createUserName: userName.value, //维护人
		orgName: orgName.value, //维护人所属单位
	},
	// 表单验证规则
	rules: {
		intensity: [
			{ required: true, message: '请选择', trigger: 'change' }
		],
		material: [
			{ required: true, message: '请选择', trigger: 'change' }
		],
		year: [
			{
				required: true,
				message: "请输入正确数值",
				validator: isYearNotMust,
				trigger: ["change", "blur"],
			}
		],
		maxSpeed: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		maxAccelaration: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		diameter: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		longitudinalWaveVelocity: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		transverseWaveVelocity: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		elasticityModulus: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		crossSectionalArea: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		foundationZCoefficient: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		earthquakeWavelength: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		earthquakewaveIncidentAngle: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		poissonsRatio: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		soilbulkDensity1: [
			{ required: false, message: "", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		burialDepth: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		soilstaticPressureCoefficient: [
			{ required: false, message: "", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		crossSectionalArea: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		emax: [
			{ required: false, message: "", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		elasticityModulus: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		pipeOd: [
			{ required: false, message: "", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		insideDiameter: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		adjustmentCoefficient1: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		adjustmentCoefficient2: [
			{ required: true, message: "请输入", trigger: "blur" },
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		yieldLimitStressCorrect: [
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		strengthLimitStressCorrect: [
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
		lxBreakStateCorrect: [
			{
				message: "请输入正确数值，最多保留四位小数",
				validator: positivedecimals,
				options: { decimals: 4 },
				trigger: ["change", "blur"],
			},
		],
	},
	// 表格
	tableFormData: {
		tableData: [],
	},
});
const {
	params,
	tableFormData,
	rules
} = toRefs(data);

// 表格
const multipleTableRef = ref();
const handleSelectionChange = (val) => {
	// multipleSelection.value = val;
};
// 导入弹框是否显示
let showUploadDialog = ref(false);
// 导入数据接口路径
const uploadUrl = ref(importContinuousWeldingUrl);
// 导入成功回调
const onImport = (response, uploadFile, uploadFiles) => {
	const { code, data } = response;
	if (code == 200 && data) {
		proxy.$modal.msgSuccess('导入数据成功!');
		// 列表数据回显
		tableFormData.value.tableData = [...data];
	}
}
// 显示弹框
const openDialog = ref(false)
const handleVerify = () => {
	openDialog.value = true;
}
// 验证
const messageList = ref([]);
const dialogVisible = ref(false);
const cancle = () => {
	dialogVisible.value = false;
}
const recalculateVersion = (version) => {
	openDialog.value = false;
	recalculate({ versionId:version.id, type: '2' }).then(res => {
		if (JSON.stringify(res.data) == '{}') {
			ElMessageBox.confirm(
				'数据通过验证，是否计算？', '提示',
				{
					confirmButtonText: '计算并保存',
					cancelButtonText: '取消',
					type: 'success',
				}
			)
				.then(() => {
					somputationSave({ versionId:version.id }).then(response => {
						if (response.code == 200) {
							router.push(`/lifelineVulnerAnalysis/lifelineMain?type=1`)
						}
					})
				}).catch(() => { })
		} else {
			const { data } = res;
			messageList.value = [];
			for (let i in data) {
				messageList.value.push({ label: `第${i}行计算参数未填写完整，请补充完整再计算。`, value: data[i] })
			}
			dialogVisible.value = true;
		}
	})
}
// 计算
const handleBrickApply = () => {
	if (tableFormData.value.tableData && tableFormData.value.tableData.length) {
		proxy.$modal.loading('正在努力计算,请耐心等待！');
		let formData = tableFormData.value.tableData[0];
		let query = {
			material: formData.material,
			id: formData.id,
			maxSpeed: formData.maxSpeed,
			maxAccelaration: formData.maxAccelaration,
			diameter: formData.diameter,
			longitudinalWaveVelocity: formData.longitudinalWaveVelocity,
			transverseWaveVelocity: formData.transverseWaveVelocity,
			elasticityModulus: formData.elasticityModulus,
			crossSectionalArea: formData.crossSectionalArea,
			foundationZCoefficient: formData.foundationZCoefficient,
			earthquakeWavelength: formData.earthquakeWavelength,
			earthquakewaveIncidentAngle: formData.earthquakewaveIncidentAngle,
			poissonsRatio: formData.poissonsRatio,
			soilbulkDensity1: formData.soilbulkDensity1,
			burialDepth: formData.burialDepth,
			soilstaticPressureCoefficient: formData.soilstaticPressureCoefficient,
			pipeOd: formData.pipeOd,
			insideDiameter: formData.insideDiameter,
			tBuriedDepth: formData.tBuriedDepth,
			linearExpansionCoefficient: formData.linearExpansionCoefficient,
			correctionFactor: formData.correctionFactor,
			temperatureDifference: formData.temperatureDifference,
			internalPressure: formData.internalPressure,
			curvature: formData.curvature,
			wallThickness: formData.wallThickness,
			yieldLimitStress: formData.yieldLimitStress,
			strengthLimitStress: formData.strengthLimitStress,
			adjustmentCoefficient1: formData.adjustmentCoefficient1,
			adjustmentCoefficient2: formData.adjustmentCoefficient2,
			lxBreakStateCorrect: formData.lxBreakStateCorrect,
			maxPipelineStrain: formData.maxPipelineStrain,
			lCos: formData.lCos,
			s: formData.maxSpeed,
			ep: formData.ep,
			zdyl: formData.zdyl,
			wqdcsdjl: formData.wqdcsdjl,
			wj: formData.wj,
			i: formData.i,
			ipai: formData.ipai,
			wqylZx: formData.wqylZx,
			jylHx: formData.jylHx,
			txjtcjyl: formData.txjtcjyl,
			wjT: formData.wjT,
			zylZxT: formData.zylZxT,
			jylHxT: formData.jylHxT,
			wdyl: formData.wdyl,
			hxlyl: formData.hxlyl,
			zxlyl: formData.zxlyl,
			soilbulkDensity2: formData.soilbulkDensity2,
			soilBurialDepth: formData.soilBurialDepth,
			soilLateralPressure: formData.soilLateralPressure,
			ps: formData.ps,
			hxyyl: formData.hxyyl,
			zxyyl: formData.zxyyl,
			allSumZx: formData.allSumZx,
			allSumHx: formData.allSumHx,
			permissibleTress: formData.permissibleTress,
			permissibleTressCorrect: formData.permissibleTressCorrect,
			lxBreakState: formData.lxBreakState,
		}

		countContinuousWelding(query).then((res) => {
			proxy.$modal.closeLoading();
			const { code, data } = res;
			if (code === 200 && data) {
				tableFormData.value.tableData = [{ ...tableFormData.value.tableData[0], ...data }];
				proxy.$modal.msgSuccess('计算完成！计算结果未保存，若需保存结果，请计算后点击提交按钮！');
			} else {
				proxy.$modal.msgError('计算失败！');
			}
		}).catch(err => {
			proxy.$modal.closeLoading();
			console.log(err.message);
		});
	} else {
		proxy.$modal.msgError('计算失败！');
	}
}
// 提交
const onSubmit = () => {
	proxy.$refs['queryRef'].validate((valid, fields) => {
		if (valid) {
			let formData = tableFormData.value.tableData[0];
			let query = {
				"type": 1, //类型
    			"upType": 2, //地下管网类型
				network2Param: {
					material: formData.material,
					id: formData.id,
					maxSpeed: formData.maxSpeed,
					maxAccelaration: formData.maxAccelaration,
					diameter: formData.diameter,
					longitudinalWaveVelocity: formData.longitudinalWaveVelocity,
					transverseWaveVelocity: formData.transverseWaveVelocity,
					elasticityModulus: formData.elasticityModulus,
					crossSectionalArea: formData.crossSectionalArea,
					foundationZCoefficient: formData.foundationZCoefficient,
					earthquakeWavelength: formData.earthquakeWavelength,
					earthquakewaveIncidentAngle: formData.earthquakewaveIncidentAngle,
					poissonsRatio: formData.poissonsRatio,
					soilbulkDensity1: formData.soilbulkDensity1,
					burialDepth: formData.burialDepth,
					soilstaticPressureCoefficient: formData.soilstaticPressureCoefficient,
					pipeOd: formData.pipeOd,
					insideDiameter: formData.insideDiameter,
					tBuriedDepth: formData.tBuriedDepth,
					linearExpansionCoefficient: formData.linearExpansionCoefficient,
					correctionFactor: formData.correctionFactor,
					temperatureDifference: formData.temperatureDifference,
					internalPressure: formData.internalPressure,
					curvature: formData.curvature,
					wallThickness: formData.wallThickness,
					yieldLimitStress: formData.yieldLimitStress,
					strengthLimitStress: formData.strengthLimitStress,
					adjustmentCoefficient1: formData.adjustmentCoefficient1,
					adjustmentCoefficient2: formData.adjustmentCoefficient2,
					lxBreakStateCorrect: formData.lxBreakStateCorrect,
					maxPipelineStrain: formData.maxPipelineStrain,
					lCos: formData.lCos,
					s: formData.maxSpeed,
					ep: formData.ep,
					zdyl: formData.zdyl,
					wqdcsdjl: formData.wqdcsdjl,
					wj: formData.wj,
					i: formData.i,
					ipai: formData.ipai,
					wqylZx: formData.wqylZx,
					jylHx: formData.jylHx,
					txjtcjyl: formData.txjtcjyl,
					wjT: formData.wjT,
					zylZxT: formData.zylZxT,
					jylHxT: formData.jylHxT,
					wdyl: formData.wdyl,
					hxlyl: formData.hxlyl,
					zxlyl: formData.zxlyl,
					soilbulkDensity2: formData.soilbulkDensity2,
					soilBurialDepth: formData.soilBurialDepth,
					soilLateralPressure: formData.soilLateralPressure,
					ps: formData.ps,
					hxyyl: formData.hxyyl,
					zxyyl: formData.zxyyl,
					allSumZx: formData.allSumZx,
					allSumHx: formData.allSumHx,
					permissibleTress: formData.permissibleTress,
					permissibleTressCorrect: formData.permissibleTressCorrect,
					lxBreakState: formData.lxBreakState,
				}
			}
			proxy.$modal.loading('正在提交,请耐心等待！');
			saveContinuousWelding(query).then((res) => {
				proxy.$modal.closeLoading();
				const { code, data } = res;
				if (code === 200) {
					tableFormData.value.tableData = [{ ...tableFormData.value.tableData[0], ...data }];
					proxy.$modal.msgSuccess("保存成功！");
					// 延迟跳转
					setTimeout(() => {
						router.push('/lifelineVulnerAnalysis/lifelineMain')
					}, 1500)
				}
			}).catch(err => {
				proxy.$modal.closeLoading();
				console.log(err.message);
			});
		} else {
			proxy.$refs['queryRef'].scrollToField(Object.keys(fields)[0])
		}
	})
}
// 获取数据
function getData(query) {
	tableFormData.value.tableData = [];
	getByIdAndType(query).then((res) => {
		const { code, data } = res;
		if (code === 200 && data) {
			const { upNetworkVo, tableEntity } = data;
			if (upNetworkVo) {
				// 基础信息
				params.value.code = tableEntity.code;
				params.value.intensity = upNetworkVo.intensity;
				params.value.year = upNetworkVo.year;
				params.value.material = upNetworkVo.material;
				// 维护时间
				const dateTime = new Date()
				params.value.createTime = parseTime(dateTime);
				// 根据id获取用户信息
				params.value.createUserName = userStore.name;
				params.value.orgName = userStore.orgName;
				// getUserInfo(tableEntity.createUser);
				//循环遍历之前加上非空判断
				tableFormData.value.tableData = [{ ...upNetworkVo, disabled: operateType.value === 'query' ? true : false }]
			}
		}
	}).catch(err => {
		console.log(err.message);
	});
}

//字典表查询
const optionList1 = ref([])
const optionList2 = ref([])
const optionList3 = ref([])
/** 获取字典值 */
async function getDictData() {
	await getValidDictItemsByDictCode("smxjsnd").then(response => {
		optionList1.value = response.data;//建造年代
	});
	await getValidDictItemsByDictCode("smxsfqk").then(response => {
		optionList2.value = response.data;//设防情况
	});
	await getValidDictItemsByDictCode("smxdxgwgc").then(response => {
		optionList3.value = response.data;//管材
	});
}
getDictData();

// 挂载
onMounted(() => {
	const id = route.query.id;
	if (id) {
		disabled.value = true;
		// 获取数据
		getData({ id, type: 1 });
	} else {
		disabled.value = false;
	}
});
</script>

<style lang="scss" scoped>
.table-wrapper {
	position: relative;

	h4 {
		font-size: 16px;
		font-weight: bold;
		color: #107ce5;
		text-align: center;
	}

	// 字体红色
	.color-red {
		color: red !important;
	}
}
</style>